<?php
/**
 *  Flvmeister
 *  a multi-format video transcoder class written in PHP5 
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by    
 *  the Free Software Foundation, either version 3 of the License, or
 *  any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @author Marco Fischer <marco@flvmeister.com>
 * @copyright Copyright (C) 2008  Marco Fischer <marco@flvmeister.com>
 * @package Flvmeister
 * @version 0.1-dev
 *
 */

/**
 * Provides an abstract class for holding configuration data
 *
 * @author Marco Fischer <marco@flvmeister.com>
 * @copyright Copyright (C) 2008  Marco Fischer <marco@flvmeister.com>
 * @package Flvmeister
 * @version 0.1-dev
 */
abstract class Flvmeister_Config_Abstract
{
    var $_values = array();
    
    /**
     * gets a value
     *
     * @param string $key
     * @return bool
     */
    public function __get( $key )
    {
        switch ( $key ) 
        {
            case "_values":
                return $this->_values;
            break;
            default:
                if ( !array_key_exists( $key, $this->_values ) )
                {
                    throw new Flvmeister_Exception( "__get: config key (".$key.") is unknown" );
                    return false;
                } else
                {
                    return $this->_values[ $key ];
                }
            break;
        }
        return false;
    }
    
    /**
     * sets a value
     *
     * @param string $key
     * @param mixed $value
     * @return bool
     */
    public function __set( $key, $value )
    {
        $this->_values[ $key ] = $value;
        return true;
    }
}